<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStaffersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('staffers', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('staffer_num', 17)->comment('员工编号');
            $table->string('staffer_name')->comment('姓名');
            $table->string('staffer_password')->comment('密码');
            $table->string('staffer_phone', 11)->comment('手机号');
            $table->string('staffer_home_phone')->comment('备用手机号');
            $table->dateTime('staffer_birthday')->comment('出生年月');
            $table->unsignedTinyInteger('staffer_sex')->default(3)->comment('性别;1/男;2/女;3/保密');
            $table->dateTime('staffer_duty_time')->comment('入职时间');
            $table->string('staffer_duty_status')->default(1)->comment('在职状态;1/在职;2/离职');
            $table->unsignedTinyInteger('staffer_departure_type')->default(1)->comment('离职类型; 1/主动离职;2/辞退');
            $table->dateTime('staffer_departure_time')->nullable(true)->default(null)->comment('离职时间');
            $table->string('staffer_departure_reason', 255)->comment('离职原因');
            $table->unique('staffer_num');
            $table->index('staffer_name');
            $table->index('staffer_phone');
            $table->timestamps();
            $table->softDeletes();
            $table->engine = "InnoDB";
            $table->charset = 'utf8mb4';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('staffers');
    }
}
